package org.example.project.bookstore.controller;

import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.example.bean.Logistics;
import org.example.project.bookstore.service.LogisticsService;
import org.example.util.JsonResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Auther:Liu
 * @Testname:LogisticsController
 * @Date:2025/8/25 19:57
 */
@RestController
@RequestMapping("/logistics")
public class LogisticsController {

    @Resource
    private LogisticsService logisticsService;

    @GetMapping("/findId")
    public JsonResult findUserId(HttpServletRequest request) {
        return logisticsService.findUserId(request.getHeader("token"));
    }

    @PostMapping
    public JsonResult saveLogistics(Logistics logistics,HttpServletRequest request) {
        return logisticsService.saveLogistics(logistics, request.getHeader("token"));
    }
}
